#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 7;
int a[MAXN];
void solve(){
	int n;
	cin >> n;
	for(int i = 1;i <= n;i++){
		cin >> a[i];
	}
	for(int i = 1;i <= n - 2;i++){
		if(a[i] < 0){
			cout << "NO" << "\n";
			return ;
		}
		if(a[i] > 0){
			int temp = a[i];
			a[i] -= a[i];
			a[i + 1] -= 2 * temp;
			a[i + 2] -= temp;
		}
	}
	if(a[n] != 0 || a[n - 1] != 0){
		cout << "NO" << "\n";
	}else{
		cout << "YES\n";
	}
}
int main(){
	int t;
	cin >> t;
	while(t--) solve();
}